<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title></title>
    <link type="text/css" href="${pageContext.request.contextPath}/shop/admin/css/Admin.css" rel="stylesheet"/>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/layui/2.6.8/css/layui.min.css">
</head>

<body>
<div class="layui-layout layui-layout-admin">
    <%@ include file="../header-side.jsp" %>
    <script>
        if ((window.location.pathname).indexOf('order') >= 0 || (window.location.pathname).indexOf('Order') >= 0) {
            document.getElementsByClassName('order')[0].className += '  layui-this '
        }
    </script>
    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div class="tables">
						<span class="layui-breadcrumb">
							<a href="${pageContext.request.contextPath}/shop/client">首页</a>
							<a><cite>订单管理</cite></a>
						</span>
            <hr>
            <table class="layui-table" lay-even lay-skin="row">
                <tr>
                    <th>ID</th>
                    <th>订单时间</th>
                    <th>收件人</th>
                    <th>地址</th>
                    <th>联系电话</th>
                    <th>总价</th>
                    <th>支付状态</th>
                    <th>用户</th>
                    <th>操作</th>
                </tr>
                <c:forEach var="item" items="${orderList}">
                    <tr>
                        <td>${item.id}</td>
                        <td>${item.orderTime}</td>
                        <td>${item.receiverName}</td>
                        <td>${item.receiverAddress}</td>
                        <td>${item.receiverPhone}</td>
                        <td>${item.money }</td>
                        <td>
                            <form class="layui-form">
                                <input type="checkbox" name="xxx" lay-skin="switch"  disabled  ${item.paystate == 1?"checked":""}>
                            </form>
                        </td>
                        <td>${item.username}</td>
                        <td>
                            <!-- 查看 -->
                            <button type="button" class="layui-btn layui-btn-sm layui-btn-primary"
                                    onclick="window.location.href='modifyOrder?id=${item.id}'">
                                <i class="layui-icon layui-icon-list"></i>
                            </button>
                            <!-- 删除 -->
                            <button type="button" class="layui-btn layui-btn-sm layui-btn-primary"
                                    onclick="delOrder('${item.id}')">
                                <i class="layui-icon layui-icon-delete"></i>
                            </button>
                        </td>
                    </tr>
                </c:forEach>
            </table>
        </div>
    </div>
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/layui/2.6.8/layui.min.js"></script>
<script>
    function delOrder(id) {
        layer.confirm('确认删除该订单吗？', {
            btn: ['确认', '取消'], //可以无限个按钮
            btn1: function (index, layero) {
                window.location.href = 'removeOrder?id=' + id
                return true;
            }
        });
    }

    layui.use(['element', 'layer', 'util'], function () {
        var element = layui.element
            , layer = layui.layer
            , util = layui.util
            , $ = layui.$;

        //头部事件
        util.event('lay-header-event', {
            //左侧菜单事件
            menuLeft: function (othis) {
                layer.msg('展开左侧菜单的操作', {icon: 0});
            }
        });
    });
</script>
</body>

</html>